package net.lab1024.sa.admin.module.business.erp.poo.controller;

import net.lab1024.sa.admin.module.business.erp.poo.domain.form.SubordAddForm;
import net.lab1024.sa.admin.module.business.erp.poo.domain.form.SubordQueryForm;
import net.lab1024.sa.admin.module.business.erp.poo.domain.form.SubordUpdateForm;
import net.lab1024.sa.admin.module.business.erp.poo.domain.vo.SubordVO;
import net.lab1024.sa.admin.module.business.erp.poo.service.SubordService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 暂收送检单 Controller
 *
 * @Author AKITA
 * @Date 2025-07-24 14:41:19
 * @Copyright AKITA
 */

@RestController
@Tag(name = "暂收送检单")
public class SubordController {

    @Resource
    private SubordService subordService;

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/subord/queryPage")
    public ResponseDTO<PageResult<SubordVO>> queryPage(@RequestBody @Valid SubordQueryForm queryForm) {
        return ResponseDTO.ok(subordService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author AKITA")
    @PostMapping("/subord/add")
    public ResponseDTO<Long> add(@RequestBody @Valid SubordAddForm addForm) {
        return subordService.add(addForm);
    }

    @Operation(summary = "更新 @author AKITA")
    @PostMapping("/subord/update")
    public ResponseDTO<String> update(@RequestBody @Valid SubordUpdateForm updateForm) {
        return subordService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author AKITA")
    @PostMapping("/subord/batchDelete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return subordService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/subord/delete/{id}")
    public ResponseDTO<String> batchDelete(@PathVariable Long id) {
        return subordService.delete(id);
    }

    @Operation(summary = "单个查询 @author AKITA")
    @GetMapping("/subord/info/{id}")
    public ResponseDTO<SubordVO> info(@PathVariable Long id) {
        return subordService.info(id);
    }

    @Operation(summary = "单个查询 @author AKITA")
    @GetMapping("/subord/infoUnexecute/{id}")
    public ResponseDTO<SubordVO> infoUnexecute(@PathVariable Long id) {
        return subordService.infoUnexecute(id);
    }
}
